import 'package:flutter/material.dart';

class Button extends StatelessWidget {
  final String label;
  final double labelFontSize;
  final Color labelColor;
  final IconData? icon;
  final double iconSize;
  final EdgeInsets iconPadding;
  final Color iconColor;
  final VoidCallback? onTap;
  final EdgeInsets padding;

  const Button({
    Key? key,
    required this.label,
    this.padding = const EdgeInsets.all(4),
    this.labelFontSize = 14,
    this.labelColor = Colors.white,
    this.icon,
    this.iconSize = 20,
    this.iconPadding = EdgeInsets.zero,
    this.iconColor = Colors.white,
    this.onTap,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: onTap,
      child: Container(
        padding: padding,
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            icon != null
                ? Padding(
                    padding: iconPadding,
                    child: Icon(
                      icon,
                      size: iconSize,
                      color: iconColor,
                    ),
                  )
                : const SizedBox.shrink(),
            const SizedBox(
              width: 5,
            ),
            Text(
              label,
              style: TextStyle(
                color: labelColor,
                fontSize: labelFontSize,
                height: 1,
              ),
            )
          ],
        ),
      ),
    );
  }
}
